package com.company;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Class002 {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(4177);
        Socket server = serverSocket.accept();

        InputStream netInput = server.getInputStream();

        FileOutputStream fileOutputStream = new FileOutputStream("update/123.jpg");

        byte[] buf = new byte[1024];
        int len = -1;
        while ((len = netInput.read(buf))!=-1){
            fileOutputStream.write(buf,0,len);
        }

    }
}
